d/rules: Dump reftest differences into the log as base64
authorSimon McVittie <smcv@debian.org>
Sat, 13 Feb 2021 16:46:57 +0000 (16:46 +0000)
committerSimon McVittie <smcv@debian.org>
Sat, 13 Feb 2021 23:33:16 +0000 (23:33 +0000)
Some of the reftests are failing reliably on buildds, but passing
reliably on the corresponding porterbox. We should inspect the
differences to check that they're close enough.

Debian package builds don't have an equivalent of $AUTOPKGTEST_ARTIFACTS
(as requested in https://bugs.launchpad.net/launchpad/+bug/1845159) so
base64-encoding the results and dumping them into the text log is the
best we can do right now.

debian/log-reftests.py [new file with mode: 0755]
debian/rules

diff --git a/debian/log-reftests.py b/debian/log-reftests.py
new file mode 100755 (executable)
index 0000000..51c5b0f
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/python3
+# Copyright 2021 Simon McVittie
+# SPDX-License-Identifier: CC0-1.0
+
+import base64
+import sys
+from pathlib import Path
+
+if __name__ == '__main__':
+    for ui in Path('testsuite', 'reftests').glob('*.ui'):
+        for outputs in (
+            Path('debian', 'build', 'deb', 'testsuite', 'reftests', 'output', 'x11'),
+        ):
+            diff = (outputs / (ui.stem + '.diff.png'))
+
+        if diff.exists():
+            ref = (outputs / (ui.stem + '.ref.png'))
+            out = (outputs / (ui.stem + '.out.png'))
+
+            for path in (ref, out, diff):
+                print('begin-base64 644 %s' % path)
+                sys.stdout.flush()
+                with open(path, 'rb') as reader:
+                    base64.encode(reader, sys.stdout.buffer)
+                print('====')
+                print('')
+
+            print('')
index 4fdf448233ae2a16756f96901c44fc8fb269e82f..f93bc39bb0ce75b18acaa922057d4fa90babbf16 100755 (executable)
@@ -249,6 +249,7 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
                --timeout-multiplier $(test_timeout_multiplier) \
        || touch debian/tests-failed
        tail -v -n +0 debian/build/deb/meson-logs/testlog-x11.txt
+       debian/log-reftests.py
        if test -e debian/tests-failed; then exit 1; fi
 endif